package com.zy.ai.langgraph4j;


import com.zy.ai.langgraph4j.node.PbbfNode;
import com.zy.ai.langgraph4j.node.PbbfcsNode;
import com.zy.ai.langgraph4j.node.ZblcNode;
import com.zy.ai.langgraph4j.node.ZbqdNode;
import org.bsc.langgraph4j.CompiledGraph;
import org.bsc.langgraph4j.GraphStateException;
import org.bsc.langgraph4j.prebuilt.MessagesState;
import org.bsc.langgraph4j.prebuilt.MessagesStateGraph;

public class TenderWorkflow {

    public CompiledGraph<MessagesState<String>> createWorkflow() {
        try {
            return new MessagesStateGraph<String>()
                    // 添加节点
                    .addNode("evaluation_method", PbbfNode.create())
                    .addNode("evaluation_params", PbbfcsNode.create())
                    .addNode("tender_process", ZblcNode.create())
                    .addNode("tender_list", ZbqdNode.create())
                    // 指定入口
                    .addEdge(MessagesStateGraph.START, "evaluation_method")
                    // 正确顺序连接节点
                    .addEdge("evaluation_method", "evaluation_params")
                    .addEdge("evaluation_params", "tender_process")
                    .addEdge("tender_process", "tender_list")
                    .addEdge("tender_list", MessagesStateGraph.END)
                    // 注意：最后节点不要再添加出边
                    .compile();
        } catch (GraphStateException e) {
            throw new RuntimeException(e);
        }
    }



}


